
GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'NewsInsert')
	DROP  Procedure  NewsInsert
GO
CREATE PROCEDURE NewsInsert
	@NewsID nvarchar(36) output,
	@ImageUrl nvarchar(200),
	@NameFull nvarchar(500),
	@NameSort nvarchar(200),
	@AbsDescription nvarchar(max),
	@Description nvarchar(max),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @NewsID = NEWID()
	INSERT INTO [News]
	(
		[NewsID],
		[ImageUrl],
		[NameFull],
		[NameSort],
		[AbsDescription],
		[Description],
		[Createdate]
	)
	VALUES
	(
		@NewsID,
		@ImageUrl,
		@NameFull,
		@NameSort,
		@AbsDescription,
		@Description,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'NewsUpdateByID')
	DROP  Procedure  NewsUpdateByID
GO
CREATE PROCEDURE NewsUpdateByID
	@NewsID nvarchar(36),
	@ImageUrl nvarchar(200),
	@NameFull nvarchar(500),
	@NameSort nvarchar(200),
	@AbsDescription nvarchar(max),
	@Description nvarchar(max),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [News]
	SET
		[ImageUrl] = @ImageUrl,
		[NameFull] = @NameFull,
		[NameSort] = @NameSort,
		[AbsDescription] = @AbsDescription,
		[Description] = @Description,
		[Createdate] = @Createdate
	WHERE NewsID = @NewsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'NewsDeleteByID')
	DROP  Procedure  NewsDeleteByID
GO
CREATE PROCEDURE NewsDeleteByID
	@NewsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [News]
	WHERE [NewsID] = @NewsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'NewsGetAll')
	DROP  Procedure  NewsGetAll
GO
CREATE PROCEDURE NewsGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [News]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'NewsGetByID')
	DROP  Procedure  NewsGetByID
GO
CREATE PROCEDURE NewsGetByID
	@NewsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [News]
	WHERE [NewsID] = @NewsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PaymentsInsert')
	DROP  Procedure  PaymentsInsert
GO
CREATE PROCEDURE PaymentsInsert
	@PaymentsID nvarchar(36) output,
	@NameFull nvarchar(200),
	@Account nvarchar(50),
	@Description nvarchar(max),
	@IsBank bigint,
	@Position int,
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @PaymentsID = NEWID()
	INSERT INTO [Payments]
	(
		[PaymentsID],
		[NameFull],
		[Account],
		[Description],
		[IsBank],
		[Position],
		[Createdate]
	)
	VALUES
	(
		@PaymentsID,
		@NameFull,
		@Account,
		@Description,
		@IsBank,
		@Position,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PaymentsUpdateByID')
	DROP  Procedure  PaymentsUpdateByID
GO
CREATE PROCEDURE PaymentsUpdateByID
	@PaymentsID nvarchar(36),
	@NameFull nvarchar(200),
	@Account nvarchar(50),
	@Description nvarchar(max),
	@IsBank bigint,
	@Position int,
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [Payments]
	SET
		[NameFull] = @NameFull,
		[Account] = @Account,
		[Description] = @Description,
		[IsBank] = @IsBank,
		[Position] = @Position,
		[Createdate] = @Createdate
	WHERE PaymentsID = @PaymentsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PaymentsDeleteByID')
	DROP  Procedure  PaymentsDeleteByID
GO
CREATE PROCEDURE PaymentsDeleteByID
	@PaymentsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [Payments]
	WHERE [PaymentsID] = @PaymentsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PaymentsGetAll')
	DROP  Procedure  PaymentsGetAll
GO
CREATE PROCEDURE PaymentsGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Payments]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PaymentsGetByID')
	DROP  Procedure  PaymentsGetByID
GO
CREATE PROCEDURE PaymentsGetByID
	@PaymentsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Payments]
	WHERE [PaymentsID] = @PaymentsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AboutUsInsert')
	DROP  Procedure  AboutUsInsert
GO
CREATE PROCEDURE AboutUsInsert
	@AboutUsID nvarchar(36) output,
	@NameFull nvarchar(500),
	@Description nvarchar(max),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @AboutUsID = NEWID()
	INSERT INTO [AboutUs]
	(
		[AboutUsID],
		[NameFull],
		[Description],
		[Createdate]
	)
	VALUES
	(
		@AboutUsID,
		@NameFull,
		@Description,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AboutUsUpdateByID')
	DROP  Procedure  AboutUsUpdateByID
GO
CREATE PROCEDURE AboutUsUpdateByID
	@AboutUsID nvarchar(36),
	@NameFull nvarchar(500),
	@Description nvarchar(max),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [AboutUs]
	SET
		[NameFull] = @NameFull,
		[Description] = @Description,
		[Createdate] = @Createdate
	WHERE AboutUsID = @AboutUsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AboutUsDeleteByID')
	DROP  Procedure  AboutUsDeleteByID
GO
CREATE PROCEDURE AboutUsDeleteByID
	@AboutUsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [AboutUs]
	WHERE [AboutUsID] = @AboutUsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AboutUsGetAll')
	DROP  Procedure  AboutUsGetAll
GO
CREATE PROCEDURE AboutUsGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [AboutUs]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AboutUsGetByID')
	DROP  Procedure  AboutUsGetByID
GO
CREATE PROCEDURE AboutUsGetByID
	@AboutUsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [AboutUs]
	WHERE [AboutUsID] = @AboutUsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ServicesInsert')
	DROP  Procedure  ServicesInsert
GO
CREATE PROCEDURE ServicesInsert
	@ServicesID nvarchar(36) output,
	@NameFull nvarchar(500),
	@Description nvarchar(max),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @ServicesID = NEWID()
	INSERT INTO [Services]
	(
		[ServicesID],
		[NameFull],
		[Description],
		[Createdate]
	)
	VALUES
	(
		@ServicesID,
		@NameFull,
		@Description,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ServicesUpdateByID')
	DROP  Procedure  ServicesUpdateByID
GO
CREATE PROCEDURE ServicesUpdateByID
	@ServicesID nvarchar(36),
	@NameFull nvarchar(500),
	@Description nvarchar(max),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [Services]
	SET
		[NameFull] = @NameFull,
		[Description] = @Description,
		[Createdate] = @Createdate
	WHERE ServicesID = @ServicesID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ServicesDeleteByID')
	DROP  Procedure  ServicesDeleteByID
GO
CREATE PROCEDURE ServicesDeleteByID
	@ServicesID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [Services]
	WHERE [ServicesID] = @ServicesID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ServicesGetAll')
	DROP  Procedure  ServicesGetAll
GO
CREATE PROCEDURE ServicesGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Services]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ServicesGetByID')
	DROP  Procedure  ServicesGetByID
GO
CREATE PROCEDURE ServicesGetByID
	@ServicesID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Services]
	WHERE [ServicesID] = @ServicesID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ShoppingCartInsert')
	DROP  Procedure  ShoppingCartInsert
GO
CREATE PROCEDURE ShoppingCartInsert
	@ShoppingCartID nvarchar(36) output,
	@OrderNumber float,
	@FullName nvarchar(200),
	@Address nvarchar(500),
	@Phone nvarchar(200),
	@Content nvarchar(max),
	@ProductsID nvarchar(36),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @ShoppingCartID = NEWID()
	INSERT INTO [ShoppingCart]
	(
		[ShoppingCartID],
		[OrderNumber],
		[FullName],
		[Address],
		[Phone],
		[Content],
		[ProductsID],
		[Createdate]
	)
	VALUES
	(
		@ShoppingCartID,
		@OrderNumber,
		@FullName,
		@Address,
		@Phone,
		@Content,
		@ProductsID,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ShoppingCartUpdateByID')
	DROP  Procedure  ShoppingCartUpdateByID
GO
CREATE PROCEDURE ShoppingCartUpdateByID
	@ShoppingCartID nvarchar(36),
	@OrderNumber float,
	@FullName nvarchar(200),
	@Address nvarchar(500),
	@Phone nvarchar(200),
	@Content nvarchar(max),
	@ProductsID nvarchar(36),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [ShoppingCart]
	SET
		[OrderNumber] = @OrderNumber,
		[FullName] = @FullName,
		[Address] = @Address,
		[Phone] = @Phone,
		[Content] = @Content,
		[ProductsID] = @ProductsID,
		[Createdate] = @Createdate
	WHERE ShoppingCartID = @ShoppingCartID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ShoppingCartDeleteByID')
	DROP  Procedure  ShoppingCartDeleteByID
GO
CREATE PROCEDURE ShoppingCartDeleteByID
	@ShoppingCartID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [ShoppingCart]
	WHERE [ShoppingCartID] = @ShoppingCartID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ShoppingCartGetAll')
	DROP  Procedure  ShoppingCartGetAll
GO
CREATE PROCEDURE ShoppingCartGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [ShoppingCart]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ShoppingCartGetByID')
	DROP  Procedure  ShoppingCartGetByID
GO
CREATE PROCEDURE ShoppingCartGetByID
	@ShoppingCartID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [ShoppingCart]
	WHERE [ShoppingCartID] = @ShoppingCartID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'TypeProductsInsert')
	DROP  Procedure  TypeProductsInsert
GO
CREATE PROCEDURE TypeProductsInsert
	@TypeProductsID nvarchar(36) output,
	@NameFull nvarchar(500),
	@NameSort nvarchar(200),
	@Postion int,
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @TypeProductsID = NEWID()
	INSERT INTO [TypeProducts]
	(
		[TypeProductsID],
		[NameFull],
		[NameSort],
		[Postion],
		[Createdate]
	)
	VALUES
	(
		@TypeProductsID,
		@NameFull,
		@NameSort,
		@Postion,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'TypeProductsUpdateByID')
	DROP  Procedure  TypeProductsUpdateByID
GO
CREATE PROCEDURE TypeProductsUpdateByID
	@TypeProductsID nvarchar(36),
	@NameFull nvarchar(500),
	@NameSort nvarchar(200),
	@Postion int,
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [TypeProducts]
	SET
		[NameFull] = @NameFull,
		[NameSort] = @NameSort,
		[Postion] = @Postion,
		[Createdate] = @Createdate
	WHERE TypeProductsID = @TypeProductsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'TypeProductsDeleteByID')
	DROP  Procedure  TypeProductsDeleteByID
GO
CREATE PROCEDURE TypeProductsDeleteByID
	@TypeProductsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [TypeProducts]
	WHERE [TypeProductsID] = @TypeProductsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'TypeProductsGetAll')
	DROP  Procedure  TypeProductsGetAll
GO
CREATE PROCEDURE TypeProductsGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [TypeProducts]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'TypeProductsGetByID')
	DROP  Procedure  TypeProductsGetByID
GO
CREATE PROCEDURE TypeProductsGetByID
	@TypeProductsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [TypeProducts]
	WHERE [TypeProductsID] = @TypeProductsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ProductsInsert')
	DROP  Procedure  ProductsInsert
GO
CREATE PROCEDURE ProductsInsert
	@ProductsID nvarchar(36) output,
	@NameFull nvarchar(500),
	@ProductsCode nvarchar(200),
	@PriceOld float,
	@Pricenew float,
	@thumbnail nvarchar(500),
	@preview nvarchar(500),
	@Isnew bigint,
	@Description nvarchar(max),
	@TypeProductsID nvarchar(36),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @ProductsID = NEWID()
	INSERT INTO [Products]
	(
		[ProductsID],
		[NameFull],
		ProductsCode,
		[PriceOld],
		[Pricenew],
		[thumbnail],
		[preview],
		[Isnew],
		[Description],
		[TypeProductsID],
		[Createdate]
	)
	VALUES
	(
		@ProductsID,
		@NameFull,
		@ProductsCode,
		@PriceOld,
		@Pricenew,
		@thumbnail,
		@preview,
		@Isnew,
		@Description,
		@TypeProductsID,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ProductsUpdateByID')
	DROP  Procedure  ProductsUpdateByID
GO
CREATE PROCEDURE ProductsUpdateByID
	@ProductsID nvarchar(36),
	@NameFull nvarchar(500),
	@ProductsCode nvarchar(200),
	@PriceOld float,
	@Pricenew float,
	@thumbnail nvarchar(500),
	@preview nvarchar(500),
	@Isnew bigint,
	@Description nvarchar(max),
	@TypeProductsID nvarchar(36),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [Products]
	SET
		[NameFull] = @NameFull,
		ProductsCode = @ProductsCode,
		[PriceOld] = @PriceOld,
		[Pricenew] = @Pricenew,
		[thumbnail] = @thumbnail,
		[preview] = @preview,
		[Isnew] = @Isnew,
		[Description] = @Description,
		[TypeProductsID] = @TypeProductsID,
		[Createdate] = @Createdate
	WHERE ProductsID = @ProductsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ProductsDeleteByID')
	DROP  Procedure  ProductsDeleteByID
GO
CREATE PROCEDURE ProductsDeleteByID
	@ProductsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [Products]
	WHERE [ProductsID] = @ProductsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ProductsGetAll')
	DROP  Procedure  ProductsGetAll
GO
CREATE PROCEDURE ProductsGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Products]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ProductsGetByID')
	DROP  Procedure  ProductsGetByID
GO
CREATE PROCEDURE ProductsGetByID
	@ProductsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Products]
	WHERE [ProductsID] = @ProductsID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PhotosInsert')
	DROP  Procedure  PhotosInsert
GO
CREATE PROCEDURE PhotosInsert
	@PhotosID nvarchar(36) output,
	@thumbnail nvarchar(500),
	@preview nvarchar(500),
	@ProductsID nvarchar(36),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	SET @PhotosID = NEWID()
	INSERT INTO [Photos]
	(
		[PhotosID],
		[thumbnail],
		[preview],
		[ProductsID],
		[Createdate]
	)
	VALUES
	(
		@PhotosID,
		@thumbnail,
		@preview,
		@ProductsID,
		@Createdate
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PhotosUpdateByID')
	DROP  Procedure  PhotosUpdateByID
GO
CREATE PROCEDURE PhotosUpdateByID
	@PhotosID nvarchar(36),
	@thumbnail nvarchar(500),
	@preview nvarchar(500),
	@ProductsID nvarchar(36),
	@Createdate datetime
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [Photos]
	SET
		[thumbnail] = @thumbnail,
		[preview] = @preview,
		[ProductsID] = @ProductsID,
		[Createdate] = @Createdate
	WHERE PhotosID = @PhotosID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PhotosDeleteByID')
	DROP  Procedure  PhotosDeleteByID
GO
CREATE PROCEDURE PhotosDeleteByID
	@PhotosID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [Photos]
	WHERE [PhotosID] = @PhotosID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PhotosGetAll')
	DROP  Procedure  PhotosGetAll
GO
CREATE PROCEDURE PhotosGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Photos]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PhotosGetByID')
	DROP  Procedure  PhotosGetByID
GO
CREATE PROCEDURE PhotosGetByID
	@PhotosID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Photos]
	WHERE [PhotosID] = @PhotosID
END
GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ProductsGetByNew')
	DROP  Procedure  ProductsGetByNew
GO

CREATE PROCEDURE [dbo].[ProductsGetByNew]
	@Isnew bit
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Products]
	WHERE [Isnew] = @Isnew
END

GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ContactsInsert')
	DROP  Procedure  ContactsInsert
GO
CREATE PROCEDURE ContactsInsert
	@ContactID nvarchar(36) output,
	@Name nvarchar(200),
	@Address nvarchar(200),
	@Email nvarchar(50),
	@Phone nvarchar(200),
	@Position int
AS
BEGIN
	SET NOCOUNT ON
	SET @ContactID = NEWID()
	INSERT INTO [Contacts]
	(
		[ContactID],
		[Name],
		[Address],
		[Email],
		[Phone],
		[Position]
	)
	VALUES
	(
		@ContactID,
		@Name,
		@Address,
		@Email,
		@Phone,
		@Position
	)
END
GO


IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ContactsUpdateByID')
	DROP  Procedure  ContactsUpdateByID
GO
CREATE PROCEDURE ContactsUpdateByID
	@ContactID nvarchar(36),
	@Name nvarchar(200),
	@Address nvarchar(200),
	@Email nvarchar(50),
	@Phone nvarchar(200),
	@Position int
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [Contacts]
	SET
		[Name] = @Name,
		[Address] = @Address,
		[Email] = @Email,
		[Phone] = @Phone,
		[Position] = @Position
	WHERE ContactID = @ContactID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ContactsDeleteByID')
	DROP  Procedure  ContactsDeleteByID
GO
CREATE PROCEDURE ContactsDeleteByID
	@ContactID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [Contacts]
	WHERE [ContactID] = @ContactID
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ContactsGetAll')
	DROP  Procedure  ContactsGetAll
GO
CREATE PROCEDURE ContactsGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Contacts]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'ContactsGetByID')
	DROP  Procedure  ContactsGetByID
GO
CREATE PROCEDURE ContactsGetByID
	@ContactID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Contacts]
	WHERE [ContactID] = @ContactID
END
GO
GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AccountInsert')
	DROP  Procedure  AccountInsert
GO
CREATE PROCEDURE AccountInsert
	@UserName nvarchar(50) output,
	@PassWord nvarchar(50),
	@Name nvarchar(500),
	@Page nvarchar(500),
	@Role bit,
	@Active bit
AS
BEGIN
	SET NOCOUNT ON
	SET @UserName = NEWID()
	INSERT INTO [Account]
	(
		[UserName],
		[PassWord],
		[Name],
		[Page],
		[Role],
		[Active]
	)
	VALUES
	(
		@UserName,
		@PassWord,
		@Name,
		@Page,
		@Role,
		@Active
	)
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AccountUpdateByID')
	DROP  Procedure  AccountUpdateByID
GO
CREATE PROCEDURE AccountUpdateByID
	@UserName nvarchar(50),
	@PassWord nvarchar(50),
	@Name nvarchar(500),
	@Page nvarchar(500),
	@Role bit,
	@Active bit
AS
BEGIN
	SET NOCOUNT ON
	UPDATE [Account]
	SET
		[PassWord] = @PassWord,
		[Name] = @Name,
		[Page] = @Page,
		[Role] = @Role,
		[Active] = @Active
	WHERE UserName = @UserName
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AccountDeleteByID')
	DROP  Procedure  AccountDeleteByID
GO
CREATE PROCEDURE AccountDeleteByID
	@UserName nvarchar(50)
AS
BEGIN
	SET NOCOUNT ON
	DELETE [Account]
	WHERE [UserName] = @UserName
END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AccountGetAll')
	DROP  Procedure  AccountGetAll
GO
CREATE PROCEDURE AccountGetAll
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Account]

END
GO



GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'AccountGetByID')
	DROP  Procedure  AccountGetByID
GO
CREATE PROCEDURE AccountGetByID
	@UserName nvarchar(50)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Account]
	WHERE [UserName] = @UserName
END
GO
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'PhotosGetByProductsId')
	DROP  Procedure  PhotosGetByProductsId
GO
CREATE PROCEDURE [dbo].[PhotosGetByProductsId]
	@ProductsID nvarchar(36)
AS
BEGIN
	SET NOCOUNT ON
	SELECT * 
	FROM [Photos]
	WHERE ProductsID = @ProductsID
END
